def data_check(data_list, data_place, data_loop_len, data_type):
    group = len(data_list) / data_loop_len
    for i in range(int(group)):
        index = data_place - 1 + (i * data_loop_len)
        if not CHECK_DICT[data_type](data_list[index]):
            return False, data_list[index]
    return True, None


def is_valid_ip_address(ip_address):
    """
    Check if an IP address is valid.

    :param ip_address: The IP address to check.
    :return: True if the IP address is valid, False otherwise.
    """
    if not ip_address:
        return False

    # Split the IP address into its octets
    octets = ip_address.split('.')

    # Check that there are exactly 4 octets
    if len(octets) != 4:
        return False

    # Check that each octet is an integer between 0 and 255
    for octet in octets:
        if not octet.isdigit():
            return False
        if int(octet) < 0 or int(octet) > 255:
            return False

    # If we made it this far, the IP address is valid
    return True


def is_valid_phone_number(phone_number):
    """
    Check if a phone number is valid.

    :param phone_number: The phone number to check.
    :return: True if the phone number is valid, False otherwise.
    """
    if not phone_number:
        return False

    # Remove any spaces or dashes from the phone number
    phone_number = phone_number.replace(' ', '').replace('-', '')

    # Check the length of the phone number
    if len(phone_number) != 11:
        return False

    # Check that all characters are digits
    if not phone_number.isdigit():
        return False

    # If we made it this far, the phone number is valid
    return True


def is_valid_email_address(email_address):
    """
    Check if an email address is valid.

    :param email_address: The email address to check.
    :return: True if the email address is valid, False otherwise.
    """
    if not email_address:
        return False

    # Split the email address into its username and domain parts
    parts = email_address.split('@')
    if len(parts) != 2:
        return False

    username, domain = parts

    # Check the domain part for validity
    if not domain:
        return False
    if domain.endswith('.'):
        return False
    if len(domain) < 3:
        return False

    # Check the username part for validity
    if not username:
        return False
    if len(username) < 1:
        return False

    # If we made it this far, the email address is valid
    return True


CHECK_DICT = {
    'ip': is_valid_ip_address,
    'phone': is_valid_phone_number,
    'mail': is_valid_email_address,
}
